home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / hf / dsp / leonid / boot.lst < prev    next >
Encoding:
File List  |  1994-03-25  |  89.7 KB  |  1,976 lines

  1. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 1
  2.  
  3.  
  4.  
  5. 1                                  page    132,79
  6. 2                                  opt     rc
  7. 4      
  8. 5                        ;***************************************************************
  9. 6                        ;* BOOT.ASM -- DSP56001 interrupt vector table and DSP CARD 4  *
  10. 7                        ;*             initialization, self cheking and communication  *
  11. 8                        ;*             service routines                             *
  12. 9                        ;*                                                       *
  13. 10                       ;* Here are all DSP56001 interrupt vectors and space for       *
  14. 11                       ;* interrupt contexts and basic interrupt service routines.    *
  15. 12                       ;* Also included are initalization code, self checking and     *
  16. 13                       ;* support routines for host communication, codec control,     *
  17. 14                       ;* low level AX25 handling and transmit control.               *
  18. 15                       ;*                                                       *
  19. 16                       ;* KISS protocol handling is based on article                 *
  20. 17                       ;*      Chepponis, M., Karn, P.:                            *
  21. 18                       ;*      "The KISS TNC: A simple Host-to-TNC communications     *
  22. 19                       ;*       protocol",                                            *
  23. 20                       ;*      Proc. of the sixth ARRL computer networking cnf., 1988 *
  24. 21                       ;*                                                       *
  25. 22                       ;* HDLC protocol handling is based on article                 *
  26. 23                       ;*      Carlson, D., E.:                                   *
  27. 24                       ;*      "Bit-Oriented Data Link Control Procedures",          *
  28. 25                       ;*      IEEE Trans. on Comm., Vol. 28, No. 4, April 1980       *
  29. 26                       ;*                                                       *
  30. 27                       ;* CRC calculation/checking is based on article                *
  31. 28                       ;*      Morse, G.:                                        *
  32. 29                       ;*      "Calculating CRCs by bits and bytes",                *
  33. 30                       ;*      BYTE Vol. 11, No. 9, September 1986                  *
  34. 31                       ;*                                                       *
  35. 32                       ;* Copyright (C) 1992-1994 by Alef Null. All rights reserved.  *
  36. 33                       ;* Author(s): Jarkko Vuori, OH2LNS                           *
  37. 34                       ;* Modification(s):                                        *
  38. 35                       ;***************************************************************
  39. 36     
  40. 37                       ; DSP CARD specific parameters
  41. 38        000001         xtal      equ     27000000  ; XTAL frq (in MHz)
  42.           9BFCC0
  43. 39        001400         topmem    equ     $1400     ; top p memory locations where buffers and monitor routines are located
  44. 40        008000         rom       equ     $8000     ; starting address of the EPROM
  45. 41        00C600         monhigh   equ     $c600     ; part of monitor to be placed on high memory
  46. 42        008000         romlen    equ     32768     ; lenght of the EPROM (in bytes)
  47. 43     
  48. 44        000100         ramx      equ     $0100     ; external X RAM st address
  49. 45        001F00         ramxlen   equ     $2000-$0100 ; external X RAM lenght
  50. 46        000100         ramy      equ     $0100     ; external Y RAM st address
  51. 47        003F00         ramylen   equ     $4000-$0100 ; external Y RAM lenght
  52. 48        000200         ramp      equ     $0200     ; external P RAM st address
  53. 49        001E00         ramplen   equ     $2000-$0200 ; external P RAM lenght
  54. 50     
  55. 51     
  56. 52                       ; SCI parameters
  57. 53        002580         baud      equ     9600      ; SCI baud rate
  58. 54        000400         buflen    equ     1024      ; SCI input/output buffer lenght
  59. 55     
  60. 56                       ; Protocol parameters
  61. 57        000000         pgm_flash equ     0         ; commands
  62. 58        000001         chg_pgm   equ     1
  63. 59        000002         read_flash equ    2
  64. 60        000003         load_go   equ     3
  65. 61     
  66. 62        000004         ack       equ     4         ; responses
  67. 63        000005         bad_crc   equ     5
  68. 64        000006         no_flash  equ     6
  69. 65        000007         erase_err equ     7
  70. 66        000008         pgm_err   equ     8
  71. 67        000009         no_pgm    equ     9
  72. 68     
  73. 69        000000         dataorp   equ     0         ; download space flags
  74. 70        000001         xory      equ     1
  75. 71     
  76. 72        002AD4         magicw    equ     10964     ; special magic word to detect first time reset
  77. 73     
  78. 74                       ; KISS special characters
  79. 75        0000C0         fend      equ     $c0
  80. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 2
  81. DSP CARD 4 Bootloader
  82.  
  83.  
  84. 76        0000DB         fesc      equ     $db
  85. 77        0000DC         tfend     equ     $dc
  86. 78        0000DD         tfesc     equ     $dd
  87. 79     
  88. 80                       ; HDLC equations
  89. 81        0000FF         flagmsk   equ     $ff       ; left justified flag mask
  90. 82        00007E         flag      equ     %01111110 ; HDLC bit flag
  91. 83        0000FE         abrtmsk   equ     $fe       ; left justified abort mask
  92. 84        0000FE         abort     equ     %11111110 ; abort sequence
  93. 85        0000FE         fivemsk   equ     $fe       ; left justified five bit mask
  94. 86        00007C         five      equ     %01111100 ; left justified five bit sequence
  95. 87        008408         poly      equ     $8408     ; HDLC CRC polynomial (x^16 + x^12 + x^5 + 1)
  96. 88        00F0B8         crcchk    equ     $f0b8     ; special CRC checkword
  97. 89     
  98. 90                       ; flags
  99. 91        000000         rempty    equ     0         ; SCI flags
  100. 92        000001         rfull     equ     1
  101. 93        000002         xempty    equ     2
  102. 94        000003         xfull     equ     3
  103. 95        000004         timer     equ     4         ; timer flag
  104. 96        000005         scmode    equ     5         ; serial communication mode
  105. 97        000006         xkissf    equ     6         ; put KISS frame begin
  106. 98        000007         ztstflg   equ     7         ; HDLC xmitter status flags
  107. 99        000008         zinsflg   equ     8
  108. 100       000009         hunt      equ     9         ; HDLC receiver status flags
  109. 101       00000A         firstb    equ     10
  110. 102       00000B         scndb     equ     11
  111. 103       00000C         pwrup     equ     12        ; set if power-up reset
  112. 104       00000D         carrier   equ     13        ; carrier on/off
  113. 105       00000E         givedat   equ     14        ; data output gate
  114. 106    
  115. 107    
  116. 108                      ; macro for green LED handling
  117. 109                      copled    macro   mode
  118. 110  m                             b\mode  #14,x:m_pbd
  119. 111  m                             endm
  120. 112    
  121. 113                      ; macro for red LED handling
  122. 114                      cmdled    macro   mode
  123. 115  m                             b\mode  #13,x:m_pbd
  124. 116  m                             endm
  125. 117    
  126. 118                      ; macro for immediate move
  127. 119                      movi      macro   data,dest
  128. 120  m                             move    data,a1
  129. 121  m                             move    a1,dest
  130. 122  m                             endm
  131. 123    
  132. 124                      ; macro for entering interrupt service routine
  133. 125                      ; stores x0,x1 and a registers
  134. 126                      enter     macro   contex
  135. 127  m                             move    x,l:<contex+0
  136. 128  m                             move    a10,l:<contex+1
  137. 129  m                             endm
  138. 130    
  139. 131                      ; macro for leaving interrupt service routine
  140. 132                      ; restores x0,x1 and a registers
  141. 133                      leave     macro   contex
  142. 134  m                             move    l:<contex+0,x
  143. 135  m                             move    l:<contex+1,a10
  144. 136  m                             rti
  145. 137  m                             endm
  146. 138    
  147. 139                      ; CRC calculation routine
  148. 140                      ; data in the LSB of a
  149. 141                      crc       macro   rem
  150. 142  m                             move    #>1,x0
  151. 143  m                             and     x0,a      rem,x0
  152. 144  m                             eor     x0,a
  153. 145  m                             lsr     a         #>poly,x0
  154. 146  m                             jcc     _crc1
  155. 147  m                             eor     x0,a
  156. 148  m                   _crc1     move    a1,rem
  157. 149  m                             endm
  158. 150    
  159. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 3
  160. DSP CARD 4 Bootloader
  161.  
  162.  
  163. 151                      ; byte CRC calculation routine
  164. 152                      ; byte in x0, result in x:<crcrem
  165. 153                      crcbyte   macro
  166. 154  m                             move    x0,b1
  167. 155  m                             move    #>$000001,x1
  168. 156  m                             move    #>poly,y1
  169. 157  m                             do      #8,_crc2
  170. 158  m 
  171. 159  m                             move    b1,a1     ; first LSB to remainder
  172. 160  m                             and     x1,a      x:<crcrem,y0
  173. 161  m                             eor     y0,a
  174. 162  m 
  175. 163  m                             lsr     a         ; XOR if needed
  176. 164  m                             jcc     _crc1
  177. 165  m                             eor     y1,a
  178. 166  m                   _crc1     lsr     b         a1,x:<crcrem
  179. 167  m                   _crc2
  180. 168  m                             endm
  181. 169    
  182. 170                      ; macro for subroutines to read word from ROM and load one ROM image
  183. 171                      romhdlr   macro   rdromb,rdromw,romload
  184. 172  m                   ; read one byte from the boot ROM to x0
  185. 173  m                   rdromb    movep   #$00f0,x:m_bcr ; slow EPROM on P bank
  186. 174  m                             move    p:(r1)+,x0
  187. 175  m                             move    #$0000ff,b1 ; mask unused databits off
  188. 176  m                             and     x0,b
  189. 177  m                             move    b1,x0
  190. 178  m                             movep   #$0000,x:m_bcr ; no more slow EPROM reads
  191. 179  m                             rts
  192. 180  m 
  193. 181  m                   ; read one word from the boot ROM to a1
  194. 182  m                   rdromw    jsr     rdromb    ; LS byte
  195. 183  m                             move    x0,y:<tmp
  196. 184  m                             jsr     rdromb    ; MS byte
  197. 185  m                             move    #>@cvi(@pow(2,8-1)),x1
  198. 186  m                             mpy     x0,x1,a   y:<tmp,x0
  199. 187  m                             move    a0,a1
  200. 188  m                             or      x0,a
  201. 189  m                             rts
  202. 190  m 
  203. 191  m                   ; load memory blocks from r1
  204. 192  m                   romload   jsr     rdromb    ; packet id
  205. 193  m                             move    x0,y:<mspace
  206. 194  m 
  207. 195  m                             jsr     rdromw    ; address
  208. 196  m                             move    a1,r0
  209. 197  m 
  210. 198  m                             jsr     rdromw    ; len
  211. 199  m                             move    a1,n0
  212. 200  m 
  213. 201  m                             jeq     _loaded
  214. 202  m                             do      n0,_contld ; fetch data
  215. 203  m                             jsr     rdromb
  216. 204  m                             move    x0,y:<tmp
  217. 205  m                             jsr     rdromb
  218. 206  m                             move    #>@cvi(@pow(2,8-1)),x1
  219. 207  m                             mpy     x0,x1,a   y:<tmp,x1
  220. 208  m                             move    a0,a1
  221. 209  m                             or      x1,a
  222. 210  m                             move    a1,y:<tmp
  223. 211  m                             jsr     rdromb
  224. 212  m                             move    #>@cvi(@pow(2,16-1)),x1
  225. 213  m                             mpy     x0,x1,a   y:<tmp,x1
  226. 214  m                             move    a0,a1
  227. 215  m                             or      x1,a
  228. 216  m                             jclr    #dataorp,y:mspace,_d
  229. 217  m                             move    a1,p:(r0)+ ; put to P space
  230. 218  m                             jmp     _a
  231. 219  m                   _d        jclr    #xory,y:mspace,_x
  232. 220  m                             move    a1,y:(r0)+ ; put to Y space
  233. 221  m                             jmp     _a
  234. 222  m                   _x        move    a1,x:(r0)+ ; put to X space
  235. 223  m                   _a        nop
  236. 224  m                   _contld
  237. 225  m                             jmp     romload
  238. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 4
  239. DSP CARD 4 Bootloader
  240.  
  241.  
  242. 226  m                   _loaded   rts
  243. 227  m                             endm
  244. 228    
  245. 229    
  246. 468    
  247. 469                      ; Reset vector
  248. 470       P:0000                   org     p:i_reset
  249. 471       P:0000 0AF080            jmp     boot
  250.                  000040
  251. 472    
  252. 473                      ; Stack error interrupt
  253. 474       P:0002                   org     p:i_stack
  254. 475       P:0002 0AF080            jmp     shdown
  255.                  00003C
  256. 476    
  257. 477                      ; Trace interrupt
  258. 478       P:0004                   org     p:i_trace
  259. 479       P:0004 0AF080            jmp     shdown
  260.                  00003C
  261. 480    
  262. 481                      ; SWI
  263. 482       P:0006                   org     p:i_swi
  264. 483       P:0006 0AF080            jmp     shdown
  265.                  00003C
  266. 484    
  267. 485                      ; IRQA
  268. 486       P:0008                   org     p:i_irqa
  269. 487       P:0008 0AF080            jmp     shdown
  270.                  00003C
  271. 488    
  272. 489                      ; IRQB
  273. 490       P:000A                   org     p:i_irqb
  274. 491       P:000A 0AF080            jmp     shdown
  275.                  00003C
  276. 492    
  277. 493                      ; SSI transmitter interrupt
  278. 494                      ;(because syncronous mode, we can use the same interrupt for both reading and writing)
  279. 495       P:0010                   org     p:i_ssitd
  280. 496       P:0010 08DFEF            movep             y:(r7)+,x:m_tx
  281. 497       P:0011 0867AF            movep             x:m_rx,x:(r7)
  282. 498    
  283. 499                      ; SSI transmitter interrupt with errors
  284. 500       P:0012                   org     p:i_ssitde
  285. 501       P:0012 0870AE            movep             x:m_sr,x:m_tx ; clear TUE
  286.                  00FFEF
  287. 502    
  288. 503                      ; SCI receive interrupt
  289. 504       P:0014                   org     p:i_scird
  290. 505       P:0014 0BF080            jsr     sci_rec
  291.                  001430
  292. 506    
  293. 507                      ; SCI receive interrupt with errors
  294. 508       P:0016                   org     p:i_scirde
  295. 509       P:0016 0BF080            jsr     sci_rec
  296.                  001430
  297. 510    
  298. 511                      ; SCI transmitter interrupt
  299. 512       P:0018                   org     p:i_scitd
  300. 513       P:0018 0BF080            jsr     sci_xmt
  301.                  00141A
  302. 514    
  303. 515                      ; SCI timer interrupt
  304. 516       P:001C                   org     p:i_scitm
  305. 517       P:001C 0BF080            jsr     sci_tim
  306.                  001400
  307. 518    
  308. 519                      ; Monitor routine jump table (here because host port is not used)
  309. 520       P:0020                   org     p:i_hstrd
  310. 521       P:0020 0AF080            jmp     opensci
  311.                  00151C
  312. 522       P:0022 0AF080            jmp     putc
  313.                  00153D
  314. 523       P:0024 0AF080            jmp     getc
  315.                  00157F
  316. 524       P:0026 0AF080            jmp     tstc
  317. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 5
  318. DSP CARD 4 Bootloader
  319.  
  320.  
  321.                  001594
  322. 525       P:0028 0AF080            jmp     endc
  323.                  00156E
  324. 526       P:002A 0AF080            jmp     rejc
  325.                  00157D
  326. 527       P:002C 0AF080            jmp     putbit
  327.                  0015F7
  328. 528       P:002E 0AF080            jmp     getbit
  329.                  001596
  330. 529       P:0030 0AF080            jmp     opencd
  331.                  001661
  332. 530       P:0032 0AF080            jmp     closecd
  333.                  001697
  334. 531       P:0034 0AF080            jmp     stimer
  335.                  00165A
  336. 532       P:0036 0AF080            jmp     putio
  337.                  00169E
  338. 533       P:0038 0AF080            jmp     caron
  339.                  0016C0
  340. 534       P:003A 0AF080            jmp     caroff
  341.                  0016AF
  342. 535    
  343. 536                      ; System error shutdown
  344. 537       P:003C 000087  shdown    stop
  345. 538    
  346. 539                      ; Illegal instruction interrupt
  347. 540       P:003E                   org     p:$003e
  348. 541       P:003E 0AF080            jmp     >shdown
  349.                  00003C
  350. 542    
  351. 543                      ;****************************
  352. 544                      ;*   Start of the program   *
  353. 545                      ;****************************
  354. 546                      ; no wait states on external memory
  355. 547       P:0040 08F4BE  boot      movep             #$0000,x:m_bcr
  356.                  000000
  357. 548    
  358. 549                      ; initialize SCI
  359. 550       P:0042 08F4B0            movep             #$2b02,x:m_scr ; 8,n,1
  360.                  002B02
  361. 551       P:0044 08F4B2            movep             #(xtal+2*16*baud)/(2*2*16*baud)-1,x:m_sccr ; round baud
  362.                  00002B
  363. 552    
  364. 553                      ; initialize port B
  365. 554       P:0046 08F4A0            movep             #$0000,x:m_pbc ; port B as general purpose port
  366.                  000000
  367. 555       P:0048 08F4A2            movep             #$60ff,x:m_pbddr ; PB0-PB7,PB13 and PB14 as outputs
  368.                  0060FF
  369. 556       P:004A 08F4A4            movep             #$0000,x:m_pbd
  370.                  000000
  371. 557    
  372. 558                      ; initialize port C
  373. 559       P:004C 08F4A1            movep             #$0003,x:m_pcc ; TXD,RXD
  374.                  000003
  375. 560       P:004E 08F4A3            movep             #$001c,x:m_pcddr ; SCLK,SC0,SC1 as output
  376.                  00001C
  377. 561       P:0050 08F4A5            movep             #$0008,x:m_pcd ; PDN up
  378.                  000008
  379. 562    
  380. 563                      ; initialize data structures
  381. 564       P:0052 54F400            move              #outbuf,a1  ; SCI queue handling
  382.                  001C00
  383. 565       P:0054 540800            move              a1,x:<xhead
  384. 566       P:0055 540900            move              a1,x:<xtail
  385. 567       P:0056 54F400            move              #inbuf,a1
  386.                  001800
  387. 568       P:0058 540200            move              a1,x:<rhead
  388. 569       P:0059 540300            move              a1,x:<rtail
  389. 570       P:005A 05F423            move              #buflen-1,m3
  390.                  0003FF
  391. 571    
  392. 572       P:005C 73F400            move              #@cvi(0.5*baud),n3 ; SCI timer system
  393.                  0012C0
  394. 573       P:005E 200013            clr     a
  395. 574       P:005F 5E0A00            move                          a,y:<timchg
  396. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 6
  397. DSP CARD 4 Bootloader
  398.  
  399.  
  400. 575       P:0060 5E0800            move                          a,y:<timcnt
  401. 576    
  402. 577       P:0061 2C0500            move              #<(1<<rempty)|(1<<xempty),a1
  403. 578       P:0062 5C0200            move                          a1,y:<flags ; buffer empty at first
  404. 579    
  405. 580       P:0063 54F400            move              #wakeup,a1
  406.                  00142C
  407. 581       P:0065 540A00            move              a1,x:<seqptr
  408. 582    
  409. 583                      ; check if power-up reset
  410. 584       P:0066 5E8C00            move                          y:<pgmptr,a ; if active program location
  411. 585       P:0067 0603A0            rep     #4-1      ; contains a special magic pattern
  412. 586       P:0068 200022            asr     a         ; this is not a power-up reset
  413. 587       P:0069 44F422            asr     a         #>magicw,x0
  414.                  002AD4
  415. 588       P:006B 200043            eor     x0,a
  416. 589       P:006C 0EA0C5            jeq     <chkok
  417. 590       P:006D 0A026C            bset    #pwrup,y:<flags
  418. 591    
  419. 592                      ; hit watchdog (because system testing will take a while)
  420. 593                                copled  chg
  421. 595    
  422. 596                      ; check the system (ROM)
  423. 597       P:006F 61F400            move              #rom,r1     ; calculate ROM's CRC sum
  424.                  008000
  425. 598       P:0071 54F400            move              #$00ffff,a1
  426.                  00FFFF
  427. 599       P:0073 540B00            move              a1,x:<crcrem
  428. 600    
  429. 601       P:0074 60F400            move              #romlen,r0
  430.                  008000
  431. 602       P:0076 06D000            do      r0,check1
  432.                  00007A
  433. 603       P:0078 0D00FE            jsr     <rdb
  434. 604       P:0079 0D0137            jsr     <crcb
  435. 605       P:007A 000000            nop
  436. 606    
  437. 607       P:007B 44F400  check1    move              #>crcchk,x0 ; check with special checkword
  438.                  00F0B8
  439. 608       P:007D 568B00            move              x:<crcrem,a
  440. 609       P:007E 200045            cmp     x0,a
  441. 610       P:007F 0E2155            jne     <rombad
  442. 611    
  443. 612                      ; check the system (RAM)
  444. 613       P:0080 54F400            move              #$00ffff,a1 ; initialize test pattern generator
  445.                  00FFFF
  446. 614       P:0082 540B00            move              a1,x:<crcrem
  447. 615    
  448. 616       P:0083 61F400            move              #ramx,r1    ; write test pattern to X ram
  449.                  000100
  450. 617       P:0085 60F400            move              #ramxlen,r0
  451.                  001F00
  452. 618       P:0087 06D000            do      r0,check2a
  453.                  00008B
  454. 619       P:0089 240000            move              #0,x0
  455. 620       P:008A 0D0147            jsr     <tstpat
  456. 621       P:008B 545900            move              a1,x:(r1)+
  457. 622                      check2a
  458. 623    
  459. 624       P:008C 61F400            move              #ramy,r1    ; write test pattern to Y ram
  460.                  000100
  461. 625       P:008E 60F400            move              #ramylen,r0
  462.                  003F00
  463. 626       P:0090 06D000            do      r0,check2b
  464.                  000094
  465. 627       P:0092 240000            move              #0,x0
  466. 628       P:0093 0D0147            jsr     <tstpat
  467. 629       P:0094 5C5900            move                          a1,y:(r1)+
  468. 630                      check2b
  469. 631    
  470. 632       P:0095 61F400            move              #ramp,r1    ; write test pattern to P ram
  471.                  000200
  472. 633       P:0097 60F400            move              #ramplen,r0
  473.                  001E00
  474. 634       P:0099 06D000            do      r0,check2c
  475. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 7
  476. DSP CARD 4 Bootloader
  477.  
  478.  
  479.                  00009D
  480. 635       P:009B 240000            move              #0,x0
  481. 636       P:009C 0D0147            jsr     <tstpat
  482. 637       P:009D 07598C            move              a1,p:(r1)+
  483. 638                      check2c
  484. 639    
  485. 640       P:009E 54F400            move              #$00ffff,a1 ; initialize test pattern generator
  486.                  00FFFF
  487. 641       P:00A0 540B00            move              a1,x:<crcrem
  488. 642    
  489. 643       P:00A1 61F400            move              #ramx,r1    ; test X ram
  490.                  000100
  491. 644       P:00A3 60F400            move              #ramxlen,r0
  492.                  001F00
  493. 645       P:00A5 240000            move              #0,x0
  494. 646       P:00A6 06D000            do      r0,check3a
  495.                  0000AC
  496. 647       P:00A8 0D0147            jsr     <tstpat
  497. 648       P:00A9 44D900            move              x:(r1)+,x0
  498. 649       P:00AA 240043            eor     x0,a      #0,x0
  499. 650       P:00AB 0E2159            jne     <rambad
  500. 651       P:00AC 000000            nop
  501. 652                      check3a
  502. 653    
  503. 654       P:00AD 61F400            move              #ramy,r1    ; test Y ram
  504.                  000100
  505. 655       P:00AF 60F400            move              #ramylen,r0
  506.                  003F00
  507. 656       P:00B1 240000            move              #0,x0
  508. 657       P:00B2 06D000            do      r0,check3b
  509.                  0000B8
  510. 658       P:00B4 0D0147            jsr     <tstpat
  511. 659       P:00B5 4CD900            move                          y:(r1)+,x0
  512. 660       P:00B6 240043            eor     x0,a      #0,x0
  513. 661       P:00B7 0E2159            jne     <rambad
  514. 662       P:00B8 000000            nop
  515. 663                      check3b
  516. 664    
  517. 665       P:00B9 61F400            move              #ramp,r1    ; test P ram
  518.                  000200
  519. 666       P:00BB 60F400            move              #ramplen,r0
  520.                  001E00
  521. 667       P:00BD 240000            move              #0,x0
  522. 668       P:00BE 06D000            do      r0,check3c
  523.                  0000C4
  524. 669       P:00C0 0D0147            jsr     <tstpat
  525. 670       P:00C1 07D984            move              p:(r1)+,x0
  526. 671       P:00C2 240043            eor     x0,a      #0,x0
  527. 672       P:00C3 0E2159            jne     <rambad
  528. 673       P:00C4 000000            nop
  529. 674                      check3c
  530. 675    
  531. 676                      ; read the remaining monitor to the upper memory
  532. 677       P:00C5 61F400  chkok     move              #monhigh,r1
  533.                  00C600
  534. 678       P:00C7 0D0110            jsr     <memload
  535. 679    
  536. 680                      ; start interrupts
  537. 681       P:00C8 08F4BF            movep             #$b000,x:m_ipr ; SSI=IPL2, SCI=IPL1
  538.                  00B000
  539. 682       P:00CA 00FCB8            andi    #$fc,mr   ; unmask interrupts
  540. 683    
  541. 684                      ; wait 1 s for the (possible) command
  542. 685                                cmdled  set
  543. 687       P:00CC 44F400            move              #>ack,x0    ; tell to host that we managed to get out from the reset
  544.                  000004
  545. 688       P:00CE 0BF080            jsr     putc
  546.                  00153D
  547. 689    
  548. 690       P:00D0 44F400            move              #>@cvi(1.0*baud),x0 ; set timer
  549.                  002580
  550. 691       P:00D2 0BF080            jsr     stimer
  551.                  00165A
  552. 692       P:00D4 000086  _wchr     wait
  553. 693       P:00D5 0BF080            jsr     getc      ; wait for chr of timer
  554. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 8
  555. DSP CARD 4 Bootloader
  556.  
  557.  
  558.                  00157F
  559. 694       P:00D7 0E00F8            jcc     <cmdok
  560. 695       P:00D8 0A02E4            jset    #timer,y:<flags,_wchr
  561.                  0000D4
  562. 696    
  563. 697                      ldpgm     cmdled  clr       ; no complete command, turn cmd led off
  564. 699       P:00DB 5E8C00            move                          y:<pgmptr,a
  565. 700       P:00DC 0A02EC            jset    #pwrup,y:<flags,firstrs
  566.                  0000F2
  567. 701    
  568. 702       P:00DE 44F400  _nopgm    move              #>$00000f,x0 ; no, calculate next pgm slot number
  569.                  00000F
  570. 703       P:00E0 44F446            and     x0,a      #>1,x0
  571.                  000001
  572. 704       P:00E2 45F440            add     x0,a      #>16,x1     ; robin round if last pgm slot number
  573.                  000010
  574. 705       P:00E4 200065            cmp     x1,a
  575. 706       P:00E5 021040            tge     x0,a
  576. 707       P:00E6 5C0C00            move                          a1,y:<pgmptr
  577. 708       P:00E7 0BF080            jsr     ldadr
  578.                  001740
  579. 709       P:00E9 5E8C00            move                          y:<pgmptr,a
  580. 710       P:00EA 0EA0DE            jeq     <_nopgm
  581. 711       P:00EB 57F400  ldnextp   move              #>magicw<<4,b ; active pgm slot found, store slot number
  582.                  02AD40
  583. 712       P:00ED 218400            move              a1,x0
  584. 713       P:00EE 20004A            or      x0,b
  585. 714       P:00EF 5D0C00            move                          b1,y:<pgmptr
  586. 715       P:00F0 0AF080            jmp     lromg     ; and load image from ROM and jump to it
  587.                  001516
  588. 716    
  589. 717       P:00F2 61F400  firstrs   move              #rom+2,r1   ; first reset, check if there are autoboot programs
  590.                  008002
  591. 718       P:00F4 0D0107            jsr     <rdw
  592. 719       P:00F5 0E20EB            jne     <ldnextp
  593. 720    
  594. 721       P:00F6 000086  _idling   wait    ; nothing to do (no command given, no program to load from ROM)
  595. 722       P:00F7 0C00F6            jmp     <_idling
  596. 723    
  597. 724                      ; command read, search command
  598. 725       P:00F8 56F400  cmdok     move              #>load_go,a
  599.                  000003
  600. 726       P:00FA 200045            cmp     x0,a
  601. 727       P:00FB 0AF0AA            jeq     lg
  602.                  0014C4
  603. 728    
  604. 729       P:00FD 0C00DA            jmp     <ldpgm
  605. 730    
  606. 731    
  607. 732                      ; temporary utility routines in internal memory
  608. 733                                romhdlr rdb,rdw,memload
  609. 789    
  610. 790                      crcb      crcbyte
  611. 805       P:0146 00000C            rts
  612. 806    
  613. 807                      ; pseudonoise RAM test pattern generator (pattern in a)
  614. 808       P:0147 0D0137  tstpat    jsr     <crcb
  615. 809       P:0148 568B00            move              x:<crcrem,a
  616. 810       P:0149 0607A0            rep     #8-1
  617. 811       P:014A 200033            lsl     a
  618. 812       P:014B 458B33            lsl     a         x:<crcrem,x1
  619. 813       P:014C 200063            eor     x1,a
  620. 814       P:014D 00000C            rts
  621. 815    
  622. 816                      ; 100 ms software delay
  623. 817       P:014E 06C785  dly100    do      #@cvi(@sqt(xtal/2.0/10.0)),_romb2
  624.                  000153
  625. 818       P:0150 06C785            do      #@cvi(@sqt(xtal/2.0/10.0)),_romb1
  626.                  000152
  627. 819       P:0152 000000            nop
  628. 820       P:0153 000000  _romb1    nop
  629. 821       P:0154 00000C  _romb2    rts
  630. 822    
  631. 823                      ; show that ROM has failed crc check (red and green led blinks at 10 Hz)
  632. 824       P:0155 0D014E  rombad    jsr     <dly100
  633. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 9
  634. DSP CARD 4 Bootloader
  635.  
  636.  
  637. 825                                copled  chg
  638. 827                                cmdled  chg
  639. 829       P:0158 0C0155            jmp     <rombad
  640. 830    
  641. 831                      ; show that RAM has failed check (greed led blinks at 10 Hz, red led blinks at 5 Hz)
  642. 832       P:0159 0D014E  rambad    jsr     <dly100
  643. 833                                copled  chg
  644. 835                                cmdled  chg
  645. 837       P:015C 0D014E            jsr     <dly100
  646. 838                                copled  chg
  647. 840       P:015E 0C0159            jmp     <rambad
  648. 841    
  649. 842    
  650. 843    
  651. 844                      ;**********************************************************
  652. 845                      ;* The following code will be placed to top p-memory bank *
  653. 846                      ;**********************************************************
  654. 847    
  655. 848       P:1400                   org     p:topmem
  656. 849    
  657. 850                      ;****************************
  658. 851                      ;*    SCI timer interrupt   *
  659. 852                      ;****************************
  660. 853                      sci_tim   enter   scidata   ; only a1,a0,x1,x0 are saved
  661. 856    
  662. 857                      ; increment timer
  663. 858       P:1402 05F423            move              #-1,m3      ; yes, set next time
  664.                  FFFFFF
  665. 859       P:1404 6B8800            move                          y:<timcnt,r3
  666. 860    
  667. 861                      ; check if destination time reached
  668. 862       P:1405 5C8900            move                          y:<timval,a1
  669. 863       P:1406 226400            move              r3,x0
  670. 864       P:1407 205B43            eor     x0,a      (r3)+
  671. 865       P:1408 0AF0A2            jne     _scit1
  672.                  00140B
  673. 866       P:140A 0A0244            bclr    #timer,y:<flags ; yes, clear flag bit
  674. 867    
  675. 868                      ; check if watch-dog interval reached
  676. 869       P:140B 5C8A00  _scit1    move                          y:<timchg,a1
  677. 870       P:140C 6B0843            eor     x0,a                  r3,y:<timcnt
  678. 871       P:140D 0AF0A2            jne     scite
  679.                  001413
  680. 872                                copled  chg
  681. 874       P:1410 204B00            move              (r3)+n3
  682. 875       P:1411 000000            nop
  683. 876       P:1412 6B0A00            move                          r3,y:<timchg
  684. 877    
  685. 878       P:1413 0BF080  scite     jsr     pertick   ; xmit control module timer
  686.                  0016E7
  687. 879       P:1415 05F423            move              #buflen-1,m3
  688.                  0003FF
  689. 880                                leave   scidata
  690. 884    
  691. 885    
  692. 886    
  693. 887                      ;****************************
  694. 888                      ;*    SCI xmit interrupt    *
  695. 889                      ;****************************
  696. 890                      sci_xmt   enter   scidata   ; only a1,a0,x1,x0 are saved
  697. 893    
  698. 894       P:141C 638900            move              x:<xtail,r3
  699. 895       P:141D 448800            move              x:<xhead,x0
  700. 896       P:141E 08DB74            movep             p:(r3)+,x:m_stxl
  701. 897       P:141F 630900            move              r3,x:<xtail
  702. 898    
  703. 899       P:1420 0A0243            bclr    #xfull,y:<flags ; don't bother to check buffer state if it is full
  704. 900       P:1421 0AF0A8            jcs     scixe
  705.                  001429
  706. 901    
  707. 902                      ; check if buffer empty
  708. 903       P:1423 226C00            move              r3,a1
  709. 904       P:1424 200043            eor     x0,a
  710. 905       P:1425 0AF0A2            jne     scixe
  711.                  001429
  712. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 10
  713. DSP CARD 4 Bootloader
  714.  
  715.  
  716. 906    
  717. 907                      ; yes, shut down xmitter
  718. 908       P:1427 0A0262            bset    #xempty,y:<flags
  719. 909       P:1428 0AB00C            bclr    #m_tie,x:m_scr
  720. 910    
  721. 911                      scixe     leave   scidata
  722. 915    
  723. 916    
  724. 917                      ;****************************
  725. 918                      ;*   SCI receive interrupt  *
  726. 919                      ;****************************
  727. 920       P:142C         wakeup    dc      $12,$b9,$b0,$a1
  728. 921                      sci_rec   enter   scidata   ; only a1,a0,x1,x0 are saved
  729. 924    
  730. 925       P:1432 084531            movep             x:m_ssr,x1  ; clear SCI errors
  731. 926    
  732. 927                      ; first check for special wake-up sequence
  733. 928       P:1433 638A00            move              x:<seqptr,r3
  734. 929       P:1434 084534            movep             x:m_srxl,x1 ; read byte to x1
  735. 930       P:1435 07DB8C            move              p:(r3)+,a1
  736. 931       P:1436 44F463            eor     x1,a      #>wakeup+4,x0
  737.                  001430
  738. 932       P:1438 0AF0AA            jeq     scir1
  739.                  00143E
  740. 933       P:143A 63F400            move              #wakeup,r3
  741.                  00142C
  742. 934       P:143C 0AF080            jmp     scir2
  743.                  001443
  744. 935       P:143E 226C00  scir1     move              r3,a1
  745. 936       P:143F 200043            eor     x0,a
  746. 937       P:1440 0AF0A2            jne     scir2
  747.                  001443
  748. 938    
  749. 939                      ; wake-up sequence detected (boot the system up)
  750. 940       P:1442 000087            stop    ; watchdog will give reset pulse
  751. 941    
  752. 942                      ; no wake-up sequence detected, continue searching
  753. 943       P:1443 630A00  scir2     move              r3,x:<seqptr
  754. 944    
  755. 945                      ; then check that there are room left in the buffer
  756. 946       P:1444 0A02E1            jset    #rfull,y:<flags,scire
  757.                  0014C1
  758. 947    
  759. 948                      ; yes, determine in which mode we are (normal, KISS mode)
  760. 949       P:1446 0A02E5            jset    #scmode,y:<flags,scir3
  761.                  001454
  762. 950    
  763. 951                      ; * normal mode, put data to buffer
  764. 952       P:1448 638200            move              x:<rhead,r3
  765. 953       P:1449 0A0240            bclr    #rempty,y:<flags
  766. 954       P:144A 075B85            move              x1,p:(r3)+
  767. 955       P:144B 630200            move              r3,x:<rhead
  768. 956    
  769. 957                      ; check buffer full condition
  770. 958       P:144C 226C00            move              r3,a1
  771. 959       P:144D 448300            move              x:<rtail,x0
  772. 960       P:144E 200043            eor     x0,a
  773. 961       P:144F 0AF0A2            jne     scire
  774.                  0014C1
  775. 962       P:1451 0A0261            bset    #rfull,y:<flags
  776. 963    
  777. 964       P:1452 0AF080            jmp     scire
  778.                  0014C1
  779. 965    
  780. 966                      ; * KISS protocol mode, read received character
  781. 967       P:1454 638C00  scir3     move              x:<getkst,r3
  782. 968       P:1455 2CC000            move              #fend,a1
  783. 969       P:1456 0AE380            jmp     (r3)      ; determine what to do for it
  784. 970    
  785. 971                      ; --- State 0, waiting for FEND
  786. 972       P:1457 44F463  str0      eor     x1,a      #>str1,x0
  787.                  00145E
  788. 973       P:1459 0AF0A2            jne     scire     ; we didn't see FEND, keep looking
  789.                  0014C1
  790. 974       P:145B 440C00            move              x0,x:<getkst ; FEND found, change state
  791. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 11
  792. DSP CARD 4 Bootloader
  793.  
  794.  
  795. 975       P:145C 0AF080            jmp     scire
  796.                  0014C1
  797. 976    
  798. 977                      ; --- State 1, we have seen FEND, look for the command byte
  799. 978       P:145E 44F463  str1      eor     x1,a      #>str2,x0
  800.                  001470
  801. 979       P:1460 0AF0AA            jeq     scire     ; just another FEND, keep looking for cmd
  802.                  0014C1
  803. 980                      ; analyze command byte
  804. 981       P:1462 2C0000            move              #0,a1
  805. 982       P:1463 450F63            eor     x1,a      x1,x:<kisscmd
  806. 983       P:1464 0AF0AA            jeq     str1b     ; cmd 0, data will follow
  807.                  00146B
  808. 984                      ; store cmd and change state
  809. 985       P:1466 54F400  str1a     move              #str4,a1
  810.                  0014AB
  811. 986       P:1468 540C00            move              a1,x:<getkst
  812. 987       P:1469 0AF080            jmp     scire
  813.                  0014C1
  814. 988                      ; start a new frame
  815. 989       P:146B 440C00  str1b     move              x0,x:<getkst
  816. 990       P:146C 548200            move              x:<rhead,a1 ; get current rhead
  817. 991       P:146D 540D00            move              a1,x:<rnhead
  818. 992       P:146E 0AF080            jmp     scire
  819.                  0014C1
  820. 993    
  821. 994                      ; --- State 2, data to follow
  822. 995       P:1470 200063  str2      eor     x1,a      ; check if end of frame
  823. 996       P:1471 0AF0AA            jeq     strend
  824.                  00147C
  825. 997       P:1473 2CDB00            move              #fesc,a1
  826. 998       P:1474 200063            eor     x1,a      ; check if escape
  827. 999       P:1475 0AF0A2            jne     store
  828.                  001499
  829. 1000                     ; escape character found
  830. 1001      P:1477 54F400            move              #str3,a1    ; enter FESC found state
  831.                  001480
  832. 1002      P:1479 540C00            move              a1,x:<getkst
  833. 1003      P:147A 0AF080            jmp     scire
  834.                  0014C1
  835. 1004                     ; end of frame, store negative value
  836. 1005      P:147C 45F400  strend    move              #-1,x1
  837.                  FFFFFF
  838. 1006      P:147E 0AF080            jmp     store
  839.                  001499
  840. 1007   
  841. 1008                     ; --- State 3, saw FESC, expecting TFESC or TFEND
  842. 1009      P:1480 2CDD00  str3      move              #tfesc,a1   ; check if TFESC
  843. 1010      P:1481 200063            eor     x1,a
  844. 1011      P:1482 0AF0AA            jeq     str3esc
  845.                  00148D
  846. 1012      P:1484 2CDC00            move              #tfend,a1
  847. 1013      P:1485 200063            eor     x1,a      ; check if TFEND
  848. 1014      P:1486 0AF0AA            jeq     str3end
  849.                  001494
  850. 1015      P:1488 54F400            move              #str2,a1
  851.                  001470
  852. 1016      P:148A 540C00            move              a1,x:<getkst ; something wrong has happened,
  853. 1017      P:148B 0AF080            jmp     scire     ; go back to the data receiving mode
  854.                  0014C1
  855. 1018                     ; we have seen TFESC after an FESC, write an FESC
  856. 1019      P:148D 54F400  str3esc   move              #str2,a1
  857.                  001470
  858. 1020      P:148F 540C00            move              a1,x:<getkst
  859. 1021      P:1490 45F400            move              #>fesc,x1
  860.                  0000DB
  861. 1022      P:1492 0AF080            jmp     store
  862.                  001499
  863. 1023                     ; we have seen TFEND after an FESC, write an FEND
  864. 1024      P:1494 54F400  str3end   move              #str2,a1
  865.                  001470
  866. 1025      P:1496 540C00            move              a1,x:<getkst
  867. 1026      P:1497 45F400            move              #>fend,x1
  868.                  0000C0
  869. 1027   
  870. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 12
  871. DSP CARD 4 Bootloader
  872.  
  873.  
  874. 1028                     ; store the character to the queue
  875. 1029      P:1499 638D00  store     move              x:<rnhead,r3
  876. 1030      P:149A 448300            move              x:<rtail,x0
  877. 1031      P:149B 075B85            move              x1,p:(r3)+
  878. 1032      P:149C 226C00            move              r3,a1       ; check buffer full
  879. 1033      P:149D 630D43            eor     x0,a      r3,x:<rnhead
  880. 1034      P:149E 0AF0AA            jeq     scr_st0   ; queue full, discard current frame
  881.                  0014BE
  882. 1035                     ; check if end of frame
  883. 1036      P:14A0 54F400            move              #-1,a1
  884.                  FFFFFF
  885. 1037      P:14A2 458D63            eor     x1,a      x:<rnhead,x1
  886. 1038      P:14A3 0AF0A2            jne     scire
  887.                  0014C1
  888. 1039   
  889. 1040      P:14A5 450200            move              x1,x:<rhead ; yes, reset real buffer write pointer
  890. 1041      P:14A6 0A0240            bclr    #rempty,y:<flags
  891. 1042      P:14A7 0BF080            jsr     frmrec    ; inform xmit control module
  892.                  0016C2
  893. 1043      P:14A9 0AF080            jmp     scr_st0
  894.                  0014BE
  895. 1044   
  896. 1045                     ; --- State 4, get command data
  897. 1046      P:14AB 580300  str4      move                          a0,y:<tmp   ; backup a0
  898. 1047      P:14AC 568F00            move              x:<kisscmd,a ; check if local parameter
  899. 1048      P:14AD 44F400            move              #>kisses,x0
  900.                  000005
  901. 1049      P:14AF 44F445            cmp     x0,a      #>kisspar-1,x0
  902.                  0016A9
  903. 1050      P:14B1 0AF0A7            jgt     str4a
  904.                  0014BA
  905. 1051   
  906. 1052      P:14B3 44F440            add     x0,a      #>baud/100,x0
  907.                  000060
  908. 1053      P:14B5 21D3A0            mpy     x0,x1,a   a,r3        ; yes, time scale parameter
  909. 1054      P:14B6 200022            asr     a         ; interger multiply correction
  910. 1055      P:14B7 076388            move              a0,p:(r3)   ; product in low order word
  911. 1056      P:14B8 0AF080            jmp     str4b
  912.                  0014BD
  913. 1057   
  914. 1058      P:14BA 6B8E00  str4a     move                          y:<kisssub,r3 ; no, give it to the user application
  915. 1059      P:14BB 568F00            move              x:<kisscmd,a
  916. 1060      P:14BC 0BE380            jsr     (r3)      ; a1 - cmd, x1 - data
  917. 1061      P:14BD 588300  str4b     move                          y:<tmp,a0
  918. 1062   
  919. 1063                     ; go back to FEND hunt state
  920. 1064      P:14BE 54F400  scr_st0   move              #str0,a1
  921.                  001457
  922. 1065      P:14C0 540C00            move              a1,x:<getkst
  923. 1066   
  924. 1067                     scire     leave   scidata
  925. 1071   
  926. 1072   
  927. 1073                     ;**************************
  928. 1074                     ;* LOAD FROM HOST AND GO  *
  929. 1075                     ;**************************
  930. 1076      P:14C4 44F400  lg        move              #>ack,x0    ; tell to host that command was accepted
  931.                  000004
  932. 1077      P:14C6 0BF080            jsr     putc
  933.                  00153D
  934. 1078   
  935. 1079      P:14C8 54F400  lghunt    move              #$00ffff,a1 ; try to find beginning of the frame
  936.                  00FFFF
  937. 1080      P:14CA 540B00            move              a1,x:<crcrem
  938. 1081      P:14CB 0BF080            jsr     rdbyte
  939.                  00170C
  940. 1082      P:14CD 56F400            move              #>flag,a
  941.                  00007E
  942. 1083      P:14CF 200045            cmp     x0,a
  943. 1084      P:14D0 0AF0A2            jne     lghunt
  944.                  0014C8
  945. 1085   
  946. 1086      P:14D2 0BF080            jsr     rdbyte    ; packet id
  947.                  00170C
  948. 1087      P:14D4 4C0B00            move                          x0,y:<mspace
  949. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 13
  950. DSP CARD 4 Bootloader
  951.  
  952.  
  953. 1088   
  954. 1089      P:14D5 0BF080            jsr     rdword    ; address
  955.                  001701
  956. 1090      P:14D7 219000            move              a1,r0
  957. 1091   
  958. 1092      P:14D8 0BF080            jsr     rdword    ; len
  959.                  001701
  960. 1093      P:14DA 219800            move              a1,n0
  961. 1094   
  962. 1095      P:14DB 0AF0AA            jeq     alldata
  963.                  0014FD
  964. 1096      P:14DD 06D800            do      n0,alldata ; fetch data
  965.                  0014FC
  966. 1097      P:14DF 0BF080            jsr     rdbyte
  967.                  00170C
  968. 1098      P:14E1 45F400            move              #>@cvi(@pow(2,16-1)),x1
  969.                  008000
  970. 1099      P:14E3 2000A0            mpy     x0,x1,a
  971. 1100      P:14E4 580300            move                          a0,y:<tmp
  972. 1101      P:14E5 0BF080            jsr     rdbyte
  973.                  00170C
  974. 1102      P:14E7 45F400            move              #>@cvi(@pow(2,8-1)),x1
  975.                  000080
  976. 1103      P:14E9 4D83A0            mpy     x0,x1,a               y:<tmp,x1
  977. 1104      P:14EA 210C00            move              a0,a1
  978. 1105      P:14EB 200062            or      x1,a
  979. 1106      P:14EC 5C0300            move                          a1,y:<tmp
  980. 1107      P:14ED 0BF080            jsr     rdbyte
  981.                  00170C
  982. 1108      P:14EF 5E8300            move                          y:<tmp,a
  983. 1109      P:14F0 200042            or      x0,a
  984. 1110      P:14F1 0A0BC0            jclr    #dataorp,y:mspace,_d
  985.                  0014F6
  986. 1111      P:14F3 07588C            move              a1,p:(r0)+  ; put to P space
  987. 1112      P:14F4 0AF080            jmp     _a
  988.                  0014FC
  989. 1113      P:14F6 0A0BC1  _d        jclr    #xory,y:mspace,_x
  990.                  0014FB
  991. 1114      P:14F8 5C5800            move                          a1,y:(r0)+  ; put to Y space
  992. 1115      P:14F9 0AF080            jmp     _a
  993.                  0014FC
  994. 1116      P:14FB 545800  _x        move              a1,x:(r0)+  ; put to X space
  995. 1117      P:14FC 000000  _a        nop
  996. 1118                     alldata
  997. 1119   
  998. 1120      P:14FD 0BF080            jsr     rdbyte    ; CRC
  999.                  00170C
  1000. 1121      P:14FF 0BF080            jsr     rdbyte
  1001.                  00170C
  1002. 1122      P:1501 44F400            move              #>crcchk,x0
  1003.                  00F0B8
  1004. 1123      P:1503 568B00            move              x:<crcrem,a
  1005. 1124      P:1504 44F445            cmp     x0,a      #>ack,x0
  1006.                  000004
  1007. 1125      P:1506 0AF0AA            jeq     _crcok
  1008.                  00150E
  1009. 1126      P:1508 44F400            move              #>bad_crc,x0 ; crc bad, ignore frame
  1010.                  000005
  1011. 1127      P:150A 0BF080            jsr     putc
  1012.                  00153D
  1013. 1128      P:150C 0AF080            jmp     lghunt
  1014.                  0014C8
  1015. 1129   
  1016. 1130      P:150E 0BF080  _crcok    jsr     putc      ; crc ok, if len=0 then jump to the user code
  1017.                  00153D
  1018. 1131      P:1510 230E00            move              n0,a
  1019. 1132      P:1511 200003            tst     a
  1020. 1133      P:1512 0AF0A2            jne     lghunt
  1021.                  0014C8
  1022. 1134                               cmdled  clr
  1023. 1136      P:1515 0C0040            jmp     <boot
  1024. 1137   
  1025. 1138   
  1026. 1139                     ;********************
  1027. 1140                     ;* LOAD ROM AND GO  *
  1028. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 14
  1029. DSP CARD 4 Bootloader
  1030.  
  1031.  
  1032. 1141                     ;********************
  1033. 1142                     ; program number is in a1 register
  1034. 1143      P:1516 0BF080  lromg     jsr     ldadr
  1035.                  001740
  1036. 1144      P:1518 219100            move              a1,r1
  1037. 1145      P:1519 0BF080            jsr     romload   ; then load the program
  1038.                  00175D
  1039. 1146      P:151B 0C0040            jmp     <boot     ; and finally jump to it
  1040. 1147   
  1041. 1148   
  1042. 1149                     ;****************************
  1043. 1150                     ;*     Open Serial line     *
  1044. 1151                     ;****************************
  1045. 1152                     ; flushes all buffers and set the desired communication speed
  1046. 1153                     ;   a - kiss command routine address (zero if not is kiss mode)
  1047. 1154                     ;   b - xmit on/off routine address
  1048. 1155      P:151C 5E0E00  opensci   move                          a,y:<kisssub
  1049. 1156      P:151D 0A0245            bclr    #scmode,y:<flags
  1050. 1157      P:151E 54F403            tst     a         #str0,a1
  1051.                  001457
  1052. 1158      P:1520 0AF0AA            jeq     opensce
  1053.                  00153C
  1054. 1159   
  1055. 1160                     ; KISS mode, initialize handlers
  1056. 1161      P:1522 5D1400            move                          b1,y:<xmitsub ; store given addresses
  1057. 1162      P:1523 540C00            move              a1,x:<getkst
  1058. 1163      P:1524 55F400            move              #(1<<xoff),b1
  1059.                  000008
  1060. 1164      P:1526 55141B            clr     b         b1,x:<pstate ; and initialize xmit control module
  1061. 1165      P:1527 5D1500            move                          b1,y:<pertim
  1062. 1166   
  1063. 1167      P:1528 0A0265            bset    #scmode,y:<flags
  1064. 1168      P:1529 0A0246            bclr    #xkissf,y:<flags
  1065. 1169   
  1066. 1170                               movi    #xstD,y:<xstate ; initialize coder
  1067. 1173                               movi    #flag,y:<xdata
  1068. 1176                               movi    #$0,y:<x5bit
  1069. 1179                               movi    #0,y:<xbit
  1070. 1182      P:1533 0A0247            bclr    #ztstflg,y:<flags
  1071. 1183      P:1534 0A0248            bclr    #zinsflg,y:<flags
  1072. 1184   
  1073. 1185                               movi    #0,x:<rdata ; initialize decoder
  1074. 1188                               movi    #$0,x:<rflag
  1075. 1191      P:1539 0A0269            bset    #hunt,y:<flags
  1076. 1192      P:153A 0A026A            bset    #firstb,y:<flags
  1077. 1193      P:153B 0A026B            bset    #scndb,y:<flags
  1078. 1194   
  1079. 1195      P:153C 00000C  opensce   rts
  1080. 1196   
  1081. 1197   
  1082. 1198                     ;****************************
  1083. 1199                     ;*  Put character to queue  *
  1084. 1200                     ;****************************
  1085. 1201                     ; byte in x0
  1086. 1202                     ; returns  Z if buffer full
  1087. 1203                     ;         NZ otherwise
  1088. 1204      P:153D 0002F8  putc      ori     #$02,mr   ; disable interrupts
  1089. 1205      P:153E 000000            nop
  1090. 1206      P:153F 000000            nop
  1091. 1207      P:1540 0A02E5            jset    #scmode,y:<flags,putkiss
  1092.                  001553
  1093. 1208   
  1094. 1209                     ; * normal mode
  1095. 1210      P:1542 458900            move              x:<xtail,x1
  1096. 1211      P:1543 548800            move              x:<xhead,a1
  1097. 1212      P:1544 219300            move              a1,r3
  1098. 1213   
  1099. 1214                     ; xmitter was running, check if there are free space left
  1100. 1215      P:1545 0A0242            bclr    #xempty,y:<flags ; if buffer empty, sure there are free space left
  1101. 1216      P:1546 0AF0A8            jcs     putc1
  1102.                  00154E
  1103. 1217      P:1548 200063            eor     x1,a      ; if read ptr <> write ptr there are also free space left
  1104. 1218      P:1549 0AF0A2            jne     putc2
  1105.                  00154F
  1106. 1219   
  1107. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 15
  1108. DSP CARD 4 Bootloader
  1109.  
  1110.  
  1111. 1220                     ; buffer full state reached (ignore given data)
  1112. 1221      P:154B 0A0263            bset    #xfull,y:<flags
  1113. 1222      P:154C 0AF080            jmp     putce
  1114.                  00156C
  1115. 1223   
  1116. 1224                     ; there was free space left, write character to the buffer
  1117. 1225      P:154E 0AB02C  putc1     bset    #m_tie,x:m_scr ; start xmitter interrupts
  1118. 1226      P:154F 075B84  putc2     move              x0,p:(r3)+
  1119. 1227      P:1550 630800            move              r3,x:<xhead
  1120. 1228      P:1551 0AF080            jmp     putce
  1121.                  00156C
  1122. 1229   
  1123. 1230   
  1124. 1231                     ; * KISS mode, check if start of new KISS frame
  1125. 1232      P:1553 0A02E6  putkiss   jset    #xkissf,y:<flags,putk1
  1126.                  00155D
  1127. 1233   
  1128. 1234                     ; yes, send KISS preamble
  1129. 1235      P:1555 0A0266            bset    #xkissf,y:<flags
  1130. 1236      P:1556 638800            move              x:<xhead,r3
  1131. 1237      P:1557 630E00            move              r3,x:<xnhead
  1132. 1238   
  1133. 1239      P:1558 2CC000            move              #fend,a1
  1134. 1240      P:1559 075B8C            move              a1,p:(r3)+
  1135. 1241      P:155A 2C0000            move              #0,a1
  1136. 1242      P:155B 075B8C            move              a1,p:(r3)+
  1137. 1243   
  1138. 1244      P:155C 630E00            move              r3,x:<xnhead
  1139. 1245   
  1140. 1246                     ; no, send pure data only
  1141. 1247      P:155D 638E00  putk1     move              x:<xnhead,r3
  1142. 1248   
  1143. 1249      P:155E 2CDB00            move              #fesc,a1    ; check if FESC
  1144. 1250      P:155F 2DDD43            eor     x0,a      #tfesc,b1
  1145. 1251      P:1560 0AF0AA            jeq     putkspe
  1146.                  001566
  1147. 1252   
  1148. 1253      P:1562 2CC000            move              #fend,a1    ; check if FEND
  1149. 1254      P:1563 2DDC43            eor     x0,a      #tfend,b1
  1150. 1255      P:1564 0AF0A2            jne     putke1
  1151.                  00156A
  1152. 1256   
  1153. 1257                     ; special character, enter escaped special character
  1154. 1258      P:1566 44F400  putkspe   move              #>fesc,x0
  1155.                  0000DB
  1156. 1259      P:1568 075B84            move              x0,p:(r3)+
  1157. 1260      P:1569 21A400            move              b1,x0
  1158. 1261   
  1159. 1262      P:156A 075B84  putke1    move              x0,p:(r3)+
  1160. 1263      P:156B 630E00            move              r3,x:<xnhead
  1161. 1264   
  1162. 1265      P:156C 00FCB8  putce     andi    #$fc,mr
  1163. 1266      P:156D 00000C            rts
  1164. 1267   
  1165. 1268   
  1166. 1269                     ;****************************
  1167. 1270                     ;* End current KISS frame   *
  1168. 1271                     ;****************************
  1169. 1272      P:156E 0002F8  endc      ori     #$02,mr   ; disable interrupts
  1170. 1273      P:156F 000000            nop
  1171. 1274      P:1570 000000            nop
  1172. 1275      P:1571 000000            nop
  1173. 1276      P:1572 0A0246            bclr    #xkissf,y:<flags
  1174. 1277   
  1175. 1278      P:1573 638E00            move              x:<xnhead,r3 ; write last fend
  1176. 1279      P:1574 44F400            move              #>fend,x0
  1177.                  0000C0
  1178. 1280      P:1576 075B84            move              x0,p:(r3)+
  1179. 1281      P:1577 630800            move              r3,x:<xhead
  1180. 1282   
  1181. 1283      P:1578 0A02C2            jclr    #xempty,y:<flags,ekisse ; check for idling xmitter
  1182.                  00157B
  1183. 1284      P:157A 0AB02C            bset    #m_tie,x:m_scr
  1184. 1285   
  1185. 1286      P:157B 00FCB8  ekisse    andi    #$fc,mr
  1186. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 16
  1187. DSP CARD 4 Bootloader
  1188.  
  1189.  
  1190. 1287      P:157C 00000C            rts
  1191. 1288   
  1192. 1289   
  1193. 1290                     ;****************************
  1194. 1291                     ;* Reject current KISS frame*
  1195. 1292                     ;****************************
  1196. 1293      P:157D 0A0246  rejc      bclr    #xkissf,y:<flags
  1197. 1294      P:157E 00000C            rts
  1198. 1295   
  1199. 1296   
  1200. 1297                     ;****************************
  1201. 1298                     ;* Get character from queue *
  1202. 1299                     ;****************************
  1203. 1300                     ; byte in x0
  1204. 1301                     ; returns  C if no data available
  1205. 1302                     ;         NC if data available
  1206. 1303      P:157F 0002F8  getc      ori     #$02,mr   ; disable interrupts
  1207. 1304      P:1580 000000            nop
  1208. 1305      P:1581 000000            nop
  1209. 1306      P:1582 000000            nop
  1210. 1307      P:1583 000000            nop
  1211. 1308      P:1584 638300            move              x:<rtail,r3
  1212. 1309   
  1213. 1310                     ; check if there are data available
  1214. 1311      P:1585 0B0260            btst    #rempty,y:<flags
  1215. 1312      P:1586 0AF0A8            jcs     getce
  1216.                  001592
  1217. 1313   
  1218. 1314                     ; yes, take it from the queue
  1219. 1315      P:1588 0A0241            bclr    #rfull,y:<flags
  1220. 1316      P:1589 07DB84            move              p:(r3)+,x0
  1221. 1317      P:158A 630300            move              r3,x:<rtail
  1222. 1318   
  1223. 1319                     ; check if buffer gets empty
  1224. 1320      P:158B 568200            move              x:<rhead,a
  1225. 1321      P:158C 226500            move              r3,x1
  1226. 1322      P:158D 200065            cmp     x1,a
  1227. 1323      P:158E 00FEB9            andi    #$fe,ccr  ; NC
  1228. 1324      P:158F 0AF0A2            jne     getce
  1229.                  001592
  1230. 1325   
  1231. 1326                     ; yes, set empty flag
  1232. 1327      P:1591 0A0260            bset    #rempty,y:<flags
  1233. 1328   
  1234. 1329      P:1592 00FCB8  getce     andi    #$fc,mr
  1235. 1330      P:1593 00000C            rts
  1236. 1331   
  1237. 1332   
  1238. 1333                     ;****************************
  1239. 1334                     ;* Test if chrs available   *
  1240. 1335                     ;****************************
  1241. 1336                     ; returns  C if no data available
  1242. 1337                     ;         NC if data available
  1243. 1338      P:1594 0B0260  tstc      btst    #rempty,y:<flags
  1244. 1339      P:1595 00000C            rts
  1245. 1340   
  1246. 1341   
  1247. 1342                     ;****************************
  1248. 1343                     ;*        Get a bit        *
  1249. 1344                     ;****************************
  1250. 1345                     ; returns next bit to be sent in C
  1251. 1346                     ; returns Z if this is an end of the transmission
  1252. 1347                     ; Note! Interrupts are disabled if end of transmission detected
  1253. 1348   
  1254. 1349                     ; check if we are allowed to send data
  1255. 1350      P:1596 0A02CE  getbit    jclr    #givedat,y:<flags,xstD2
  1256.                  0015F5
  1257. 1351   
  1258. 1352                     ; check if we must insert a zero
  1259. 1353      P:1598 0A0248            bclr    #zinsflg,y:<flags
  1260. 1354      P:1599 0AF0A8            jcs     getins
  1261.                  0015BD
  1262. 1355   
  1263. 1356                     ; check if there are bits left
  1264. 1357      P:159B 5E9200            move                          y:<xbit,a
  1265. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 17
  1266. DSP CARD 4 Bootloader
  1267.  
  1268.  
  1269. 1358      P:159C 688F03            tst     a                     y:<xstate,r0
  1270. 1359      P:159D 000000            nop
  1271. 1360      P:159E 0AE0AA            jeq     (r0)
  1272. 1361   
  1273. 1362                     ; five bit sequence detection logic
  1274. 1363      P:159F 0A02C7  getsft0   jclr    #ztstflg,y:<flags,getsft1 ; check if logic enabled
  1275.                  0015AB
  1276. 1364      P:15A1 5E9000            move                          y:<xdata,a
  1277. 1365      P:15A2 200023            lsr     a
  1278. 1366      P:15A3 5E9100            move                          y:<x5bit,a
  1279. 1367      P:15A4 44F427            ror     a         #>$f80000,x0
  1280.                  F80000
  1281. 1368      P:15A6 200046            and     x0,a
  1282. 1369      P:15A7 5C1145            cmp     x0,a                  a1,y:<x5bit
  1283. 1370      P:15A8 0AF0A2            jne     getsft1
  1284.                  0015AB
  1285. 1371   
  1286. 1372                     ; 11111 detected, insert zero
  1287. 1373      P:15AA 0A0268            bset    #zinsflg,y:<flags
  1288. 1374   
  1289. 1375                     ; calculate CRC
  1290. 1376      P:15AB 5E9000  getsft1   move                          y:<xdata,a
  1291. 1377                               crc     y:<xcrcrem
  1292. 1385   
  1293. 1386                     ; shift data out (LSB first) and decrement bit counter
  1294. 1387      P:15B6 689200            move                          y:<xbit,r0
  1295. 1388      P:15B7 5E9000            move                          y:<xdata,a
  1296. 1389      P:15B8 205023            lsr     a         (r0)-
  1297. 1390      P:15B9 681200            move                          r0,y:<xbit
  1298. 1391      P:15BA 5C1000            move                          a1,y:<xdata
  1299. 1392      P:15BB 00FBB9            andi    #$fb,ccr  ; NZ
  1300. 1393      P:15BC 00000C            rts
  1301. 1394   
  1302. 1395                     ; insert zero bit
  1303. 1396      P:15BD 200013  getins    clr     a         ; reset five bit counter
  1304. 1397      P:15BE 5C1100            move                          a1,y:<x5bit
  1305. 1398      P:15BF 00FAB9            andi    #$fa,ccr  ; NC NZ
  1306. 1399      P:15C0 00000C            rts
  1307. 1400   
  1308. 1401   
  1309. 1402                     ; --- A, after a begin flag
  1310. 1403                     xstA
  1311. 1404                     ; set up data xmission
  1312. 1405                               movi    #xstB,y:<xstate
  1313. 1408                               movi    #$00ffff,y:<xcrcrem ; init CRC generator
  1314. 1411      P:15C7 0A0267            bset    #ztstflg,y:<flags ; enable 11111 checker
  1315. 1412   
  1316. 1413                     ; --- B, after data byte sent
  1317. 1414                     xstB      movi    #8,y:<xbit ; init bit counter for the next byte
  1318. 1417      P:15CA 0BF080            jsr     getc      ; fetch next byte
  1319.                  00157F
  1320. 1418      P:15CC 4C1000            move                          x0,y:<xdata
  1321. 1419      P:15CD 208E00            move              x0,a
  1322. 1420      P:15CE 200003            tst     a
  1323. 1421      P:15CF 0AF0A3            jpl     getsft0
  1324.                  00159F
  1325. 1422   
  1326. 1423                     ; last databyte sent, send CRC
  1327. 1424                               movi    #xstC,y:<xstate
  1328. 1427                               movi    #16,y:<xbit
  1329. 1430      P:15D6 5E9300            move                          y:<xcrcrem,a
  1330. 1431      P:15D7 200017            not     a
  1331. 1432      P:15D8 5C1000            move                          a1,y:<xdata
  1332. 1433      P:15D9 0AF080            jmp     getsft0
  1333.                  00159F
  1334. 1434   
  1335. 1435                     ; --- C, after CRC sent
  1336. 1436                     xstC      movi    #xstD,y:<xstate
  1337. 1439                               movi    #flag,y:<xdata
  1338. 1442                               movi    #8,y:<xbit
  1339. 1445      P:15E2 0A0247            bclr    #ztstflg,y:<flags ; disable 11111 checker
  1340. 1446      P:15E3 0AF080            jmp     getsft0
  1341.                  00159F
  1342. 1447   
  1343. 1448                     ; --- D, after the last flag sent
  1344. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 18
  1345. DSP CARD 4 Bootloader
  1346.  
  1347.  
  1348. 1449      P:15E5 0BF080  xstD      jsr     tstc
  1349.                  001594
  1350. 1450      P:15E7 0AF0A8            jcs     xstD1
  1351.                  0015F3
  1352. 1451   
  1353. 1452                     ; new data to send, start a new frame
  1354. 1453                               movi    #xstA,y:<xstate
  1355. 1456                               movi    #flag,y:<xdata
  1356. 1459                               movi    #8,y:<xbit
  1357. 1462      P:15F0 0AF080            jmp     getsft0
  1358.                  00159F
  1359. 1463      P:15F2 00000C            rts
  1360. 1464   
  1361. 1465                     ; no new data, return with Z
  1362. 1466      P:15F3 0BF080  xstD1     jsr     rdempty   ; inform xmit control module
  1363.                  0016D9
  1364. 1467      P:15F5 0004F9  xstD2     ori     #$04,ccr
  1365. 1468      P:15F6 00000C            rts
  1366. 1469   
  1367. 1470   
  1368. 1471                     ;****************************
  1369. 1472                     ;*        Put a bit        *
  1370. 1473                     ;****************************
  1371. 1474                     ; put next bit in C to the host transmit queue
  1372. 1475      P:15F7 569100  putbit    move              x:<rflag,a
  1373. 1476      P:15F8 2FFE27            ror     a         #abrtmsk,b
  1374. 1477      P:15F9 541100            move              a1,x:<rflag
  1375. 1478      P:15FA 218400            move              a1,x0
  1376. 1479   
  1377. 1480                     ; check if abort sequence detected
  1378. 1481      P:15FB 26FE4E            and     x0,b      #abort,y0
  1379. 1482      P:15FC 20005B            eor     y0,b
  1380. 1483      P:15FD 0AF0AA            jeq     putb4
  1381.                  001656
  1382. 1484   
  1383. 1485                     ; check if flag detected
  1384. 1486      P:15FF 2FFF00            move              #flagmsk,b
  1385. 1487      P:1600 267E4E            and     x0,b      #flag,y0
  1386. 1488      P:1601 2EFE5B            eor     y0,b      #fivemsk,a
  1387. 1489      P:1602 0AF0AA            jeq     putb3     ; yes, special handling
  1388.                  001633
  1389. 1490   
  1390. 1491                     ; check if 11111 sequence detected
  1391. 1492      P:1604 267C46            and     x0,a      #five,y0
  1392. 1493      P:1605 208F53            eor     y0,a      x0,b
  1393. 1494      P:1606 0AF0AA            jeq     putb2     ; yes, ignore this bit
  1394.                  001632
  1395. 1495   
  1396. 1496                     ; no special sequence detected, shift data normally
  1397. 1497      P:1608 0A02E9            jset    #hunt,y:<flags,putb2
  1398.                  001632
  1399. 1498      P:160A 56903B            lsl     b         x:<rdata,a
  1400. 1499      P:160B 45F427            ror     a         #>@pow(2,-15),x1
  1401.                  000100
  1402. 1500      P:160D 541000            move              a1,x:<rdata
  1403. 1501      P:160E 218400            move              a1,x0
  1404. 1502   
  1405. 1503                     ; calculate CRC
  1406. 1504      P:160F 45F4A0            mpy     x0,x1,a   #>1,x1      ; shift to right 15 bits
  1407.                  000001
  1408. 1505                               crc     x:<rcrcrem
  1409. 1513   
  1410. 1514                     ; decrement the bit counter
  1411. 1515      P:161B 569200            move              x:<rbit,a
  1412. 1516      P:161C 2D0864            sub     x1,a      #8,b1
  1413. 1517      P:161D 541200            move              a1,x:<rbit
  1414. 1518      P:161E 0AF0A2            jne     putb2
  1415.                  001632
  1416. 1519   
  1417. 1520                     ; 8 bit shifted, init bit counter again
  1418. 1521      P:1620 551200            move              b1,x:<rbit
  1419. 1522      P:1621 0A024A            bclr    #firstb,y:<flags
  1420. 1523      P:1622 0AF0A0            jcc     putb1
  1421.                  001628
  1422. 1524   
  1423. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 19
  1424. DSP CARD 4 Bootloader
  1425.  
  1426.  
  1427. 1525                     ; first byte, init CRC checker
  1428. 1526      P:1624 54F400            move              #$00ffff,a1
  1429.                  00FFFF
  1430. 1527      P:1626 541300            move              a1,x:<rcrcrem
  1431. 1528      P:1627 00000C            rts
  1432. 1529   
  1433. 1530                     ; data bytes, put it to the queue
  1434. 1531      P:1628 0A024B  putb1     bclr    #scndb,y:<flags
  1435. 1532      P:1629 0AF0A8            jcs     putb2
  1436.                  001632
  1437. 1533      P:162B 569000            move              x:<rdata,a
  1438. 1534      P:162C 44F400            move              #>$ff,x0
  1439.                  0000FF
  1440. 1535      P:162E 200046            and     x0,a
  1441. 1536      P:162F 218400            move              a1,x0
  1442. 1537      P:1630 0BF080            jsr     putc
  1443.                  00153D
  1444. 1538   
  1445. 1539                     ; discard the previous bit
  1446. 1540      P:1632 00000C  putb2     rts
  1447. 1541   
  1448. 1542                     ; flag detected
  1449. 1543      P:1633 0A0249  putb3     bclr    #hunt,y:<flags
  1450. 1544                               movi    #8,x:<rbit
  1451. 1547      P:1636 0A026A            bset    #firstb,y:<flags
  1452. 1548      P:1637 0A026B            bset    #scndb,y:<flags
  1453. 1549      P:1638 0AF0A0            jcc     putb3a    ; reject frame if it is too short
  1454.                  00163D
  1455. 1550      P:163A 0BF080            jsr     rejc
  1456.                  00157D
  1457. 1551      P:163C 00000C            rts
  1458. 1552   
  1459. 1553                     ; calculate the last CRC bit
  1460. 1554      P:163D 449000  putb3a    move              x:<rdata,x0
  1461. 1555      P:163E 45F400            move              #>@pow(2,-16),x1 ; shift to right 16 bits
  1462.                  000080
  1463. 1556      P:1640 2000A0            mpy     x0,x1,a
  1464. 1557                               crc     x:<rcrcrem
  1465. 1565   
  1466. 1566                     ; check that it is valid
  1467. 1567      P:164B 44F400            move              #>crcchk,x0
  1468.                  00F0B8
  1469. 1568      P:164D 200043            eor     x0,a
  1470. 1569      P:164E 0AF0A2            jne     putb3b    ; reject frame if CRC failed
  1471.                  001653
  1472. 1570      P:1650 0BF080            jsr     endc
  1473.                  00156E
  1474. 1571      P:1652 00000C            rts
  1475. 1572      P:1653 0BF080  putb3b    jsr     rejc
  1476.                  00157D
  1477. 1573      P:1655 00000C            rts
  1478. 1574   
  1479. 1575                     ; abort detected
  1480. 1576      P:1656 0A0269  putb4     bset    #hunt,y:<flags
  1481. 1577      P:1657 0BF080            jsr     rejc
  1482.                  00157D
  1483. 1578      P:1659 00000C            rts
  1484. 1579   
  1485. 1580   
  1486. 1581                     ;****************************
  1487. 1582                     ;*       Request timer     *
  1488. 1583                     ;****************************
  1489. 1584                     ; delay in x0 (in 1/baud s)
  1490. 1585      P:165A 5E8800  stimer    move                          y:<timcnt,a
  1491. 1586      P:165B 44F440            add     x0,a      #>$00ffff,x0
  1492.                  00FFFF
  1493. 1587      P:165D 200046            and     x0,a
  1494. 1588      P:165E 5C0900            move                          a1,y:<timval
  1495. 1589      P:165F 0A0264            bset    #timer,y:<flags
  1496. 1590      P:1660 00000C            rts
  1497. 1591   
  1498. 1592   
  1499. 1593                     ;****************************
  1500. 1594                     ;*     Open codec driver    *
  1501. 1595                     ;****************************
  1502. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 20
  1503. DSP CARD 4 Bootloader
  1504.  
  1505.  
  1506. 1596                     ; Start-up Crystal CS4215 Codec
  1507. 1597                     ;   r7 - address of the modulo buffer (x: A/D, y: D/A)
  1508. 1598                     ;   m7 - lenght of the modulo buffer
  1509. 1599                     ;   x0 - samping rate:
  1510. 1600                     ;       8      kHz   $000000
  1511. 1601                     ;       9.6    kHz   $003800
  1512. 1602                     ;      16       kHz   $000800
  1513. 1603                     ;      27.42857 kHz   $001000
  1514. 1604                     ;      32       kHz   $001800
  1515. 1605                     ;      48       kHz   $003000
  1516. 1606                     ;
  1517. 1607                     ;
  1518. 1608                     ; program SSI to handle Crystal's initial communication mode
  1519. 1609      P:1661 08F4AC  opencd    movep             #$4f05,x:m_cra ; 16-bit, 16 frames
  1520.                  004F05
  1521. 1610      P:1663 08F4AD            movep             #$3b3c,x:m_crb ; generate SCLK and FS
  1522.                  003B3C
  1523. 1611   
  1524. 1612      P:1665 08F4A1            movep             #$01e3,x:m_pcc ; TXD,RXD,SC2,SCK,SRD,STD
  1525.                  0001E3
  1526. 1613      P:1667 08F4A3            movep             #$001c,x:m_pcddr ; SCLK,SC0,SC1 as output
  1527.                  00001C
  1528. 1614      P:1669 08F4A5            movep             #$0000,x:m_pcd ; PDN down (wake up Crystal)
  1529.                  000000
  1530. 1615   
  1531. 1616                     ; send control blocks to the Crystal until we get valid responce from it
  1532. 1617      P:166B 5C8400            move                          y:<cryconf,a1 ; add sampling rate info to configuration block
  1533. 1618      P:166C 60F442            or      x0,a      #cryconf,r0
  1534.                  000004
  1535. 1619      P:166E 5C0400            move                          a1,y:<cryconf
  1536. 1620      P:166F 0503A0            move              #4-1,m0
  1537. 1621   
  1538. 1622      P:1670 0BF080  wakeCry   jsr     outblk    ; send control info until CLB is low
  1539.                  001734
  1540. 1623      P:1672 0A06B2            jset    #2+16,x:tmpblk+2,wakeCry
  1541.                  001670
  1542. 1624   
  1543. 1625                     ; Crystal is configured, send final control block
  1544. 1626      P:1674 0A0472            bset    #2+16,y:<cryconf+0 ; set CLB high
  1545. 1627      P:1675 060A80            do      #10,confok ; at least two frames after CLB high
  1546.                  001679
  1547. 1628      P:1677 0BF080            jsr     outblk    ; and ensure that at least 50 ms elapsed after leaving from PDN state
  1548.                  001734
  1549. 1629      P:1679 000000            nop
  1550. 1630      P:167A 05F420  confok    move              #-1,m0
  1551.                  FFFFFF
  1552. 1631   
  1553. 1632                     ; reset and reprogram SSI again because we will get clock and frame signals from Crystal
  1554. 1633      P:167C 08F4A1            movep             #$0003,x:m_pcc ; SRD,STD
  1555.                  000003
  1556. 1634      P:167E 08F4AC            movep             #$4305,x:m_cra ; 16-bit, 4 frames
  1557.                  004305
  1558. 1635      P:1680 08F4AD            movep             #$3b0c,x:m_crb ; receive SCLK and FS
  1559.                  003B0C
  1560. 1636      P:1682 08F4A1            movep             #$01e3,x:m_pcc ; TXD,RXD,SC2,SCK,SRD,STD
  1561.                  0001E3
  1562. 1637   
  1563. 1638                     ; then start data transfer and synchronize to it
  1564. 1639      P:1684 08F4A5            movep             #$0010,x:m_pcd ; D/C high (switch Crystal to data mode)
  1565.                  000010
  1566. 1640   
  1567. 1641      P:1686 0AAE86  waitsyn   jclr    #m_tde,x:m_sr,waitsyn ; wait for the frame sync
  1568.                  001686
  1569. 1642      P:1688 0AAEA2            jset    #m_tfs,x:m_sr,frmsync
  1570.                  00168E
  1571. 1643      P:168A 0870AF            movep             x:m_rx,x:m_tsr
  1572.                  00FFEE
  1573. 1644      P:168C 0AF080            jmp     waitsyn
  1574.                  001686
  1575. 1645   
  1576. 1646      P:168E 060380  frmsync   do      #4-1,flshfrm ; then get rid of the remaining data
  1577.                  001693
  1578. 1647      P:1690 0AAE86  _loop     jclr    #m_tde,x:m_sr,_loop
  1579.                  001690
  1580. 1648      P:1692 08DFEF            movep             y:(r7)+,x:m_tx
  1581. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 21
  1582. DSP CARD 4 Bootloader
  1583.  
  1584.  
  1585. 1649      P:1693 0867AF            movep             x:m_rx,x:(r7)
  1586. 1650      P:1694 08F4AD  flshfrm   movep             #$7b0c,x:m_crb ; enable transmit interrupts
  1587.                  007B0C
  1588. 1651   
  1589. 1652      P:1696 00000C            rts
  1590. 1653   
  1591. 1654   
  1592. 1655                     ;****************************
  1593. 1656                     ;*     Close codec driver   *
  1594. 1657                     ;****************************
  1595. 1658                     ; close SSI interface and set codec to power down mode
  1596. 1659      P:1697 08F4A1  closecd   movep             #$0003,x:m_pcc ; TXD,RXD
  1597.                  000003
  1598. 1660      P:1699 08F4A3            movep             #$001c,x:m_pcddr ; SCLK,SC0,SC1 as output
  1599.                  00001C
  1600. 1661      P:169B 08F4A5            movep             #$0008,x:m_pcd ; PDN up
  1601.                  000008
  1602. 1662   
  1603. 1663      P:169D 00000C            rts
  1604. 1664   
  1605. 1665   
  1606. 1666                     ;****************************
  1607. 1667                     ;*    Update output port    *
  1608. 1668                     ;****************************
  1609. 1669                     ; put lowest eight bits in x0 register to general purpose i/o-port
  1610. 1670      P:169E 0002F8  putio     ori     #$02,mr   ; disable interrupts
  1611. 1671      P:169F 54F400            move              #>$0000ff,a1
  1612.                  0000FF
  1613. 1672      P:16A1 44F446            and     x0,a      #>$ffff00,x0
  1614.                  FFFF00
  1615. 1673      P:16A3 218500            move              a1,x1
  1616. 1674   
  1617. 1675      P:16A4 084E24            movep             x:m_pbd,a
  1618. 1676      P:16A5 200046            and     x0,a
  1619. 1677      P:16A6 200062            or      x1,a
  1620. 1678      P:16A7 08CC24            movep             a1,x:m_pbd
  1621. 1679   
  1622. 1680      P:16A8 00FCB8            andi    #$fc,mr
  1623. 1681      P:16A9 00000C            rts
  1624. 1682   
  1625. 1683                     ; *** Persistence routines ***
  1626. 1684   
  1627. 1685                     ; state bits
  1628. 1686      000000         xstart    equ     0
  1629. 1687      000001         xstop     equ     1
  1630. 1688      000002         xon       equ     2
  1631. 1689      000003         xoff      equ     3
  1632. 1690      000004         xwait     equ     4
  1633. 1691   
  1634. 1692                     ; kiss parameters
  1635. 1693      000001         txdelay   equ     1
  1636. 1694      000002         P         equ     2
  1637. 1695      000003         SlotTim   equ     3
  1638. 1696      000004         TXtail    equ     4
  1639. 1697      000005         FullDup   equ     5
  1640. 1698   
  1641. 1699      P:16AA         kisspar   dc      @cvi(50*baud/100.0) ; txdelay
  1642. 1700      P:16AB                   dc      @cvi(63*baud/100.0) ; P
  1643. 1701      P:16AC                   dc      @cvi(10*baud/100.0) ; SlotTim
  1644. 1702      P:16AD                   dc      @cvi(1*baud/100.0) ; TXtail
  1645. 1703      P:16AE                   dc      0         ; FullDup
  1646. 1704      000005         kisses    equ     *-kisspar
  1647. 1705   
  1648. 1706                     ;****************************
  1649. 1707                     ;*   Carrier off routine    *
  1650. 1708                     ;****************************
  1651. 1709                     ; inform Leonid that there are no data transmissions ongoing
  1652. 1710      P:16AF 0002F8  caroff    ori     #$02,mr
  1653. 1711      P:16B0 000000            nop
  1654. 1712      P:16B1 000000            nop
  1655. 1713      P:16B2 000000            nop
  1656. 1714      P:16B3 0A024D            bclr    #carrier,y:<flags
  1657. 1715   
  1658. 1716      P:16B4 0A1484            jclr    #xwait,x:<pstate,_car1
  1659.                  0016BE
  1660. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 22
  1661. DSP CARD 4 Bootloader
  1662.  
  1663.  
  1664. 1717   
  1665. 1718      P:16B6 2C0100            move              #(1<<xstart),a1 ; start xmitter
  1666. 1719      P:16B7 541400            move              a1,x:<pstate
  1667. 1720   
  1668. 1721      P:16B8 6B9400            move                          y:<xmitsub,r3 ; call XMIT ON
  1669. 1722      P:16B9 0001F9            ori     #$01,ccr
  1670. 1723      P:16BA 0BE380            jsr     (r3)
  1671. 1724   
  1672. 1725      P:16BB 07F08C            move              p:kisspar+txdelay-1,a1 ; and set txdelay timer
  1673.                  0016AA
  1674. 1726      P:16BD 5C1500            move                          a1,y:<pertim
  1675. 1727      P:16BE 00FCB8  _car1     andi    #$fc,mr
  1676. 1728      P:16BF 00000C            rts
  1677. 1729   
  1678. 1730   
  1679. 1731                     ;****************************
  1680. 1732                     ;*   Carrier off routine    *
  1681. 1733                     ;****************************
  1682. 1734                     ; inform Leonid that there are no data transmissions ongoing
  1683. 1735      P:16C0 0A026D  caron     bset    #carrier,y:<flags
  1684. 1736      P:16C1 00000C            rts
  1685. 1737   
  1686. 1738   
  1687. 1739                     ; one KISS frame received
  1688. 1740      P:16C2 0A14A3  frmrec    jset    #xoff,x:<pstate,_frm1
  1689.                  0016C7
  1690. 1741      P:16C4 0A14A1            jset    #xstop,x:<pstate,_frm2
  1691.                  0016D5
  1692. 1742      P:16C6 00000C            rts
  1693. 1743   
  1694. 1744      P:16C7 0A02ED  _frm1     jset    #carrier,y:<flags,_frm1a ; if no carrier, then start xmitter
  1695.                  0016D2
  1696. 1745      P:16C9 6B9400            move                          y:<xmitsub,r3 ; call user's xmit on routine
  1697. 1746      P:16CA 0001F9            ori     #$01,ccr
  1698. 1747      P:16CB 0BE380            jsr     (r3)
  1699. 1748   
  1700. 1749      P:16CC 2C0100            move              #(1<<xstart),a1 ; and change to XSTART state
  1701. 1750      P:16CD 541400            move              a1,x:<pstate
  1702. 1751   
  1703. 1752      P:16CE 07F08C            move              p:kisspar+txdelay-1,a1 ; and set txdelay timer
  1704.                  0016AA
  1705. 1753      P:16D0 5C1500            move                          a1,y:<pertim
  1706. 1754      P:16D1 00000C            rts
  1707. 1755   
  1708. 1756      P:16D2 2C1000  _frm1a    move              #(1<<xwait),a1 ; carrier, wait until it disappears
  1709. 1757      P:16D3 541400            move              a1,x:<pstate
  1710. 1758      P:16D4 00000C            rts
  1711. 1759   
  1712. 1760      P:16D5 2C0400  _frm2     move              #(1<<xon),a1 ; curretly shutting down, but continue directly
  1713. 1761      P:16D6 541400            move              a1,x:<pstate
  1714. 1762   
  1715. 1763      P:16D7 0A026E            bset    #givedat,y:<flags
  1716. 1764      P:16D8 00000C            rts
  1717. 1765   
  1718. 1766                     ; trying to read empty buffer
  1719. 1767      P:16D9 0002F8  rdempty   ori     #$02,mr
  1720. 1768      P:16DA 000000            nop
  1721. 1769      P:16DB 000000            nop
  1722. 1770      P:16DC 000000            nop
  1723. 1771      P:16DD 0A1482            jclr    #xon,x:<pstate,_rde1
  1724.                  0016E5
  1725. 1772   
  1726. 1773      P:16DF 2C0200            move              #(1<<xstop),a1 ; stop transmitting
  1727. 1774      P:16E0 541400            move              a1,x:<pstate
  1728. 1775   
  1729. 1776      P:16E1 07F08C            move              p:kisspar+TXtail-1,a1 ; and set txdelay timer
  1730.                  0016AD
  1731. 1777      P:16E3 5C1500            move                          a1,y:<pertim
  1732. 1778   
  1733. 1779      P:16E4 0A024E            bclr    #givedat,y:<flags
  1734. 1780      P:16E5 00FCB8  _rde1     andi    #$fc,mr
  1735. 1781      P:16E6 00000C            rts
  1736. 1782   
  1737. 1783                     ; 1/baud s timer ticks here
  1738. 1784      P:16E7 5C9500  pertick   move                          y:<pertim,a1
  1739. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 23
  1740. DSP CARD 4 Bootloader
  1741.  
  1742.  
  1743. 1785      P:16E8 44F400            move              #>0,x0
  1744.                  000000
  1745. 1786      P:16EA 219343            eor     x0,a      a1,r3
  1746. 1787      P:16EB 0AF0AA            jeq     _pert1
  1747.                  0016F6
  1748. 1788      P:16ED 205300            move              (r3)-       ; check if timer elapsed
  1749. 1789      P:16EE 226C00            move              r3,a1
  1750. 1790      P:16EF 6B1543            eor     x0,a                  r3,y:<pertim
  1751. 1791      P:16F0 0AF0A2            jne     _pert1
  1752.                  0016F6
  1753. 1792      P:16F2 0A14A0            jset    #xstart,x:<pstate,_pert2
  1754.                  0016F7
  1755. 1793      P:16F4 0A14A1            jset    #xstop,x:<pstate,_pert3
  1756.                  0016FB
  1757. 1794      P:16F6 00000C  _pert1    rts
  1758. 1795   
  1759. 1796      P:16F7 2C0400  _pert2    move              #(1<<xon),a1 ; start xmitting
  1760. 1797      P:16F8 541400            move              a1,x:<pstate
  1761. 1798   
  1762. 1799      P:16F9 0A026E            bset    #givedat,y:<flags ; start giving data to the application program
  1763. 1800      P:16FA 00000C            rts
  1764. 1801   
  1765. 1802      P:16FB 2C0800  _pert3    move              #(1<<xoff),a1 ; stop xmitting
  1766. 1803      P:16FC 541400            move              a1,x:<pstate
  1767. 1804   
  1768. 1805      P:16FD 6B9400            move                          y:<xmitsub,r3 ; call user's xmit off
  1769. 1806      P:16FE 00FEB9            andi    #$fe,ccr
  1770. 1807      P:16FF 0BE380            jsr     (r3)
  1771. 1808      P:1700 00000C            rts
  1772. 1809   
  1773. 1810   
  1774. 1811                     ; read one word (updating CRC)
  1775. 1812      P:1701 0BF080  rdword    jsr     rdbyte    ; MS byte
  1776.                  00170C
  1777. 1813      P:1703 45F400            move              #>@cvi(@pow(2,8-1)),x1
  1778.                  000080
  1779. 1814      P:1705 2000A0            mpy     x0,x1,a
  1780. 1815      P:1706 580300            move                          a0,y:<tmp
  1781. 1816      P:1707 0BF080            jsr     rdbyte    ; LS byte
  1782.                  00170C
  1783. 1817      P:1709 5E8300            move                          y:<tmp,a
  1784. 1818      P:170A 200042            or      x0,a
  1785. 1819      P:170B 00000C            rts
  1786. 1820   
  1787. 1821                     ; wait 1s for the next character and update CRC calculation
  1788. 1822      P:170C 44F400  rdbyte    move              #>@cvi(1.0*baud),x0 ; set timer (1s)
  1789.                  002580
  1790. 1823      P:170E 0BF080            jsr     stimer
  1791.                  00165A
  1792. 1824      P:1710 0BF080            jsr     waitchr
  1793.                  001723
  1794. 1825                               crcbyte ; calculate CRC of byte in x0, result in x:<crcrem
  1795. 1840      P:1721 00000C            rts
  1796. 1841   
  1797. 1842   
  1798. 1843                     ; wait for (predetermined time) the next character
  1799. 1844      P:1722 000086  wchr      wait
  1800. 1845      P:1723 0BF080  waitchr   jsr     getc      ; wait for chr of timer
  1801.                  00157F
  1802. 1846      P:1725 0AF0A0            jcc     chrfnd
  1803.                  001733
  1804. 1847      P:1727 0A02E4            jset    #timer,y:<flags,wchr
  1805.                  001722
  1806. 1848   
  1807. 1849      P:1729 44F400  sleep     move              #>@cvi(0.5*baud),x0 ; timer elapsed
  1808.                  0012C0
  1809. 1850      P:172B 0BF080            jsr     stimer    ; error condition, blink cmd led
  1810.                  00165A
  1811. 1851      P:172D 000086  _sleep1   wait
  1812. 1852      P:172E 0A02E4            jset    #timer,y:<flags,_sleep1
  1813.                  00172D
  1814. 1853                               cmdled  chg
  1815. 1855      P:1731 0AF080            jmp     sleep
  1816.                  001729
  1817. 1856   
  1818. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 24
  1819. DSP CARD 4 Bootloader
  1820.  
  1821.  
  1822. 1857      P:1733 00000C  chrfnd    rts     ; chr found
  1823. 1858   
  1824. 1859   
  1825. 1860                     ; Output one 256 bit block (codec in the first time slot)
  1826. 1861      P:1734 060480  outblk    do      #4,outblk1 ; actual data transfer on the first slot only
  1827.                  001739
  1828. 1862      P:1736 0AAE86  _loop     jclr    #m_tde,x:m_sr,_loop
  1829.                  001736
  1830. 1863      P:1738 0860AF            movep             x:m_rx,x:(r0)
  1831. 1864      P:1739 08D8EF            movep             y:(r0)+,x:m_tx
  1832. 1865   
  1833. 1866      P:173A 060C80  outblk1   do      #16-4,outblk2 ; idling remainig slots
  1834.                  00173E
  1835. 1867      P:173C 0AAE86  _loop     jclr    #m_tde,x:m_sr,_loop
  1836.                  00173C
  1837. 1868      P:173E 08CC2E            movep             a1,x:m_tsr
  1838. 1869   
  1839. 1870      P:173F 00000C  outblk2   rts
  1840. 1871   
  1841. 1872   
  1842. 1873                     ; Calculate program load address (to a1) from the address in a1
  1843. 1874                     ; returns Z if no program in a given slot
  1844. 1875      P:1740 0603A0  ldadr     rep     #4-1      ; first calculate directory entry address (16*id+rom)
  1845. 1876      P:1741 200033            lsl     a
  1846. 1877      P:1742 44F433            lsl     a         #>rom,x0
  1847.                  008000
  1848. 1878      P:1744 200040            add     x0,a
  1849. 1879      P:1745 219100            move              a1,r1       ; then fetch the load address
  1850. 1880      P:1746 0BF080            jsr     romrdw
  1851.                  001752
  1852. 1881      P:1748 00000C            rts
  1853. 1882   
  1854. 1883   
  1855. 1884                               romhdlr romrdb,romrdw,romload
  1856. 1940   
  1857. 1941   
  1858. 1942                     ; serial buffers
  1859. 1943      P:1800         inbuf     dsm     buflen
  1860. 1944      P:1C00         outbuf    dsm     buflen
  1861. 1945   
  1862. 1946   
  1863. 1947                     ;****************************
  1864. 1948                     ;*  CONTEX STORE FOR INTS   *
  1865. 1949                     ;****************************
  1866. 1950   
  1867. 1951      L:0000                   org     l:$0000
  1868. 1952   
  1869. 1953      L:0000         scidata   ds      2
  1870. 1954   
  1871. 1955   
  1872. 1956      X:0002                   org     x:$0002
  1873. 1957   
  1874. 1958      X:0002         rhead     ds      1
  1875. 1959      X:0003         rtail     ds      1
  1876. 1960   
  1877. 1961      X:0004         tmpblk    dsm     4
  1878. 1962   
  1879. 1963      X:0008         xhead     ds      1
  1880. 1964      X:0009         xtail     ds      1
  1881. 1965      X:000A         seqptr    ds      1
  1882. 1966      X:000B         crcrem    ds      1
  1883. 1967   
  1884. 1968      X:000C         getkst    ds      1
  1885. 1969      X:000D         rnhead    ds      1
  1886. 1970      X:000E         xnhead    ds      1
  1887. 1971      X:000F         kisscmd   ds      1
  1888. 1972   
  1889. 1973      X:0010         rdata     ds      1         ; current byte received
  1890. 1974      X:0011         rflag     ds      1         ; one bit counter
  1891. 1975      X:0012         rbit      ds      1         ; received bit counter
  1892. 1976      X:0013         rcrcrem   ds      1         ; CRC remainder
  1893. 1977   
  1894. 1978      X:0014         pstate    ds      1         ; xmit control module state
  1895. 1979   
  1896. 1980   
  1897. Motorola DSP56000 Assembler  Version 3.1  94-03-25  12:36:01  boot.asm  Page 25
  1898. DSP CARD 4 Bootloader
  1899.  
  1900.  
  1901. 1981      Y:0002                   org     y:$0002
  1902. 1982   
  1903. 1983      Y:0002         flags     ds      1
  1904. 1984      Y:0003         tmp       ds      1
  1905. 1985   
  1906. 1986                     ; Crystal CS4215 configuration data
  1907. 1987                     ; Stereo, 16-bit linear, XTAL1, 64 bit/frame, generate SCLK and FSYNC
  1908. 1988      Y:0004         cryconf   dc      %0000000000000100<<8 ; Control Time Slot 1 & 2
  1909. 1989      Y:0005                   dc      %0001001000000000<<8 ; Control Time Slot 3 & 4
  1910. 1990      Y:0006                   dc      %0000000000000000<<8 ; Control Time Slot 5 & 6
  1911. 1991      Y:0007                   dc      %0000000000000000<<8 ; Control Time Slot 7 & 8
  1912. 1992   
  1913. 1993      Y:0008         timcnt    ds      1
  1914. 1994      Y:0009         timval    ds      1
  1915. 1995      Y:000A         timchg    ds      1
  1916. 1996      Y:000B         mspace    ds      1
  1917. 1997      Y:000C         pgmptr    ds      1
  1918. 1998   
  1919. 1999      Y:000D         khead     ds      1
  1920. 2000      Y:000E         kisssub   ds      1
  1921. 2001   
  1922. 2002      Y:000F         xstate    ds      1         ; current xmitter state
  1923. 2003      Y:0010         xdata     ds      1         ; current byte to be send
  1924. 2004      Y:0011         x5bit     ds      1         ; one bit counter
  1925. 2005      Y:0012         xbit      ds      1         ; send bits counter
  1926. 2006      Y:0013         xcrcrem   ds      1         ; CRC remainder
  1927. 2007   
  1928. 2008      Y:0014         xmitsub   ds      1         ; xmit control module xmit routine address store
  1929. 2009      Y:0015         pertim    ds      1         ; xmit control module timer
  1930. 2010   
  1931. 2011   
  1932. 2012                               end
  1933.  
  1934. 0    Errors
  1935. 0    Warnings
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.